package com.shujia.spark.mllib

import java.io.StringReader

import org.wltea.analyzer.core.IKSegmenter

import scala.collection.mutable.ListBuffer

object IK {
  def main(args: Array[String]): Unit = {

    val text = "我爱数加学院"

    println(fit(text))
  }

  def fit(line: String): List[String] = {

    val lf = new ListBuffer[String]

    val sr = new StringReader(line)
    val ik = new IKSegmenter(sr, true)

    var lex = ik.next()
    while (lex != null) {
      lf.+=(lex.getLexemeText)
      lex = ik.next()
    }

    lf.toList
  }

}
